Don't repeat the malloc/free function pointer change messages
authorMukund Sivaraman <muks@banu.com>
Sun, 19 Apr 2015 19:30:58 +0000 (01:00 +0530)
committerMukund Sivaraman <muks@banu.com>
Sun, 19 Apr 2015 19:30:58 +0000 (01:00 +0530)
babl/babl-memory.c

index f0291e79b9667d2a1209e6afa9bb880df33b18de..d9e4d2fd692e3559682824db9235d986aac5e361 100644 (file)
@@ -84,16 +84,19 @@ functions_sanity (void)
   if (first_malloc_used != malloc_f ||
       first_free_used != free_f)
     {
+      static int displayed = 0;
+
       if (first_malloc_used == NULL)
         {
           first_malloc_used = malloc_f;
           first_free_used   = free_f;
         }
-      else
+      else if (!displayed)
         {
           fprintf (stderr, "HMM....\nSomething strange is happening,\n%s function pointer changing between invocations in babl.\n",
                    first_malloc_used == malloc_f ? "free" :
                    (first_free_used == free_f ? "malloc" : "malloc and free"));
+          displayed = 1;
         }
     }
 }